<?php
class Application_Model_LoaiBaiViet extends Zend_Db_Table
{
	protected $_name='loaibaiviet';

	public function getLoaiBaiViet($id)
	{
		$id = (int)$id;
		$row = $this->fetchRow('id = ' . $id);
		if (!$row) {
			throw new Exception("Khong tim thay loai bai viet $id");
		}
		return $row->toArray();
	}//phuong thuc tra ve mot dong theo $id

	public function addLoaiBaiViet($tenloai)
	{
		$data = array(
				'tenloai' => $tenloai,
		);
		$this->insert($data);
	}//insert

	public function updateLoaiBaiViet($id,$tenloai)
	{
		$data = array(
				'tenloai'=>$tenloai,
		);
		$this->update($data, 'id = '. (int)$id);
	}//update

	public function deleteLoaiBaiViet($id)
	{
		$this->delete('id =' . (int)$id);
	}//drop
	
}